import {type PaginationProps} from 'antd/lib/pagination'

type paginationDeploy = PaginationProps & {
    onChange?: (pageNo: number, pageSize: number) => void
}

export const usePagination = (searchForm: Record<string, any>, total: number, pageOnChange: Function): paginationDeploy => {
    return {
        size: 'default',
        current: searchForm.pageNo,
        pageSize: searchForm.pageSize,
        total,
        onChange: (pageNo: number, pageSize: number) => pageOnChange(pageNo, pageSize),
        showTotal: (e) => `共 ${e} 条`,
        showSizeChanger: true,
        showQuickJumper: true
    }
}
